package com.web.controller;
import com.web.entity.ResponseResult;
import com.web.entity.User;
import com.web.service.UserService;
import jakarta.annotation.Resource;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author: XiangHu
 * @date: 2025年03月20日 17:22
 * @describe:
 */
@CrossOrigin(origins = "*")
@RestController
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/login")
    public ResponseResult login(String username, String password) {
       User user= userService.login(username, password);
       return new ResponseResult(200,"登录成功",user);
    }
    @RequestMapping("/updateUser")
    public ResponseResult updateUser(User user) {
        userService.updateUser(user);
        return new ResponseResult(200,"更新成功",null);
    }
}
